/* Sales Order Template Styles */
* { 
    box-sizing: border-box; 
}

body { 
    font-family: 'Calibri', Arial, sans-serif; 
    font-size: 9pt; 
    color: #0c0c0c; 
    margin: 0; 
    padding: 20px; 
    background: #ffffff; 
}

.invoice-container { 
    max-width: 800px; 
    margin: 0 auto; 
    background: #ffffff; 
}

.invoice-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 20px; 
}

.invoice-title { 
    font-size: 20px; 
    font-weight: 700; 
    letter-spacing: 1px; 
    color: #0c0c0c; 
    margin-bottom: 10px;
}

.invoice-meta { 
    font-size: 12px; 
    color: #666; 
}

.invoice-meta table { 
    width: 100%; 
    border-collapse: collapse; 
}

.invoice-meta td { 
    padding: 4px 8px; 
    border: none; 
}

.invoice-meta .label { 
    font-weight: 600; 
    width: 120px; 
}

.address-section { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 20px; 
}

.address-block { 
    width: 48%; 
}

.address-title { 
    font-weight: 600; 
    font-size: 12px; 
    margin-bottom: 8px; 
    color: #0c0c0c; 
}

.address-content { 
    font-size: 11px; 
    line-height: 1.4; 
    color: #333; 
}

.items-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
}

.items-table th, 
.items-table td { 
    border: 1px solid #d8d8d8; 
    padding: 8px; 
    text-align: left; 
    vertical-align: top; 
}

.items-table th { 
    background-color: #f1f1f1; 
    font-weight: 600; 
    font-size: 9px; 
    text-transform: uppercase; 
    letter-spacing: 0.3px; 
}

.items-table .text-right { 
    text-align: right; 
}

.item-code { 
    font-size: 9px; 
    color: #0c0c0c; 
}

.item-name { 
    font-weight: 600; 
    font-size: 9px; 
    color: #0c0c0c; 
}

.item-description { 
    font-size: 8px; 
    color: #666; 
    margin-top: 2px; 
}

.totals-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
}

.totals-table td { 
    padding: 6px 8px; 
    border: none; 
}

.totals-table .label { 
    text-align: left; 
    font-size: 10px; 
}

.totals-table .amount { 
    text-align: right; 
    font-size: 10px; 
}

.totals-table .grand-total { 
    font-weight: 700; 
    font-size: 10px; 
}

.payment-section { 
    margin-top: 30px; 
    padding: 15px; 
    background-color: #f9fafb; 
    border: 1px dashed #ccc; 
}

.payment-title { 
    font-weight: 600; 
    font-size: 9px; 
    margin-bottom: 8px; 
    color: #0c0c0c; 
}

.payment-content { 
    font-size: 9px; 
    color: #666; 
}

.company-info { 
    margin-top: 20px; 
    font-size: 11px; 
    color: #444; 
    line-height: 1.6; 
}

.company-name { 
    font-weight: 600; 
    margin-bottom: 5px; 
}

.terms-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9fafb;
    border: 1px solid #ddd;
}

.terms-title {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 10px;
    color: #0c0c0c;
}

.terms-content {
    font-size: 10px;
    color: #333;
    line-height: 1.4;
}

.bank-details {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9fafb;
    border: 1px solid #ddd;
}

.bank-title {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 10px;
    color: #0c0c0c;
}

.bank-content {
    font-size: 10px;
    color: #333;
    line-height: 1.4;
}

.bank-content table {
    width: 100%;
    border-collapse: collapse;
}

.bank-content td {
    padding: 4px 8px;
    border: none;
}

.bank-content .label {
    font-weight: 600;
    width: 120px;
}

/* 自定义状态样式 */
.status-custom {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
}

.status-to-manufacturing {
    background-color: #6f42c1;
    color: white;
}

.status-to-shipment {
    background-color: #20c997;
    color: white;
}

.status-to-deliver {
    background-color: #17a2b8;
    color: white;
}

/* 自定义字段样式 */
.custom-fields-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.custom-fields-title {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 15px;
    color: #0c0c0c;
}

.custom-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.custom-field {
    display: flex;
    flex-direction: column;
}

.custom-field-label {
    font-weight: 600;
    font-size: 10px;
    margin-bottom: 5px;
    color: #333;
}

.custom-field-value {
    font-size: 10px;
    color: #666;
    padding: 5px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.file-attachment {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

/* 响应式设计 */
@media print {
    body {
        padding: 0;
    }
    
    .invoice-container {
        max-width: none;
    }
    
    .custom-fields-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .address-section {
        flex-direction: column;
    }
    
    .address-block {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .custom-fields-grid {
        grid-template-columns: 1fr;
    }
    
    .invoice-header {
        flex-direction: column;
    }
}
